<?php 
set_time_limit(0);
require 'vendor/autoload.php';

use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;

echo 'START TRANSACTION;';
echo "<br />";

$inputFileName = '6.xls';
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName);
$sheetData = $spreadsheet->getActiveSheet()->toArray(null, false, false, true);
$i=1;
foreach($sheetData as $v){
    if (!empty($v['A']) &&  !empty($v['B']) && '准考证' != $v['A']){
		 $hao=trim($v['A']);
		 $qu=@trim($v['B']);
		 $school=trim($v['C']);
		 $nianji=trim($v['E']);
		 $name=trim($v['D']);
         $idcard=@addslashes(trim($v['F'])); 
         $phone=@trim($v['G']);
		 $kc=@trim($v['H']);
		 $sql="insert into app_student(hao,qu,school,nianji,name,kc,idcard,phone) values('".$hao."','".$qu."','".$school."','".$nianji."','".$name."','".$kc."','".$idcard."','".$phone."'); ";
		 echo $sql;
		 echo "<br />";
	}
    $i++;
} 



$inputFileName = '7.xls';
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName);
$sheetData = $spreadsheet->getActiveSheet()->toArray(null, false, false, true);
$i=1;
foreach($sheetData as $v){
    if (!empty($v['A']) &&  !empty($v['B']) && '准考证' != $v['A']){
		 $hao=trim($v['A']);
		 $qu=@trim($v['B']);
		 $school=trim($v['C']);
		 $nianji=trim($v['E']);
		 $name=trim($v['D']);
         $idcard=@addslashes(trim($v['F'])); 
         $phone=@trim($v['G']);
		 $kc=@trim($v['H']);
		 $sql="insert into app_student(hao,qu,school,nianji,name,kc,idcard,phone) values('".$hao."','".$qu."','".$school."','".$nianji."','".$name."','".$kc."','".$idcard."','".$phone."'); ";
		 echo $sql;
		 echo "<br />";
	}
    $i++;
} 



$inputFileName = '8.xls';
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName);
$sheetData = $spreadsheet->getActiveSheet()->toArray(null, false, false, true);
$i=1;
foreach($sheetData as $v){
    if (!empty($v['A']) &&  !empty($v['B']) && '准考证' != $v['A']){
		 $hao=trim($v['A']);
		 $qu=@trim($v['B']);
		 $school=trim($v['C']);
		 $nianji=trim($v['E']);
		 $name=trim($v['D']);
         $idcard=@addslashes(trim($v['F'])); 
         $phone=@trim($v['G']);
		 $kc=@trim($v['H']);
		 $sql="insert into app_student(hao,qu,school,nianji,name,kc,idcard,phone) values('".$hao."','".$qu."','".$school."','".$nianji."','".$name."','".$kc."','".$idcard."','".$phone."'); ";
		 echo $sql;
		 echo "<br />";
	}
    $i++;
}

$inputFileName = '9.xls';
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName);
$sheetData = $spreadsheet->getActiveSheet()->toArray(null, false, false, true);
$i=1;
foreach($sheetData as $v){
    if (!empty($v['A']) &&  !empty($v['B']) && '准考证' != $v['A']){
		 $hao=trim($v['A']);
		 $qu=@trim($v['B']);
		 $school=trim($v['C']);
		 $nianji=trim($v['E']);
		 $name=trim($v['D']);
         $idcard=@addslashes(trim($v['F'])); 
         $phone=@trim($v['G']);
		 $kc=@trim($v['H']);
		 $sql="insert into app_student(hao,qu,school,nianji,name,kc,idcard,phone) values('".$hao."','".$qu."','".$school."','".$nianji."','".$name."','".$kc."','".$idcard."','".$phone."'); ";
		 echo $sql;
		 echo "<br />";
	}
    $i++;
}


$inputFileName = 'g1.xls';
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName);
$sheetData = $spreadsheet->getActiveSheet()->toArray(null, false, false, true);
$i=1;
foreach($sheetData as $v){
    if (!empty($v['A']) &&  !empty($v['B']) && '准考证' != $v['A']){
		 $hao=trim($v['A']);
		 $qu=@trim($v['B']);
		 $school=trim($v['C']);
		 $nianji=trim($v['E']);
		 $name=trim($v['D']);
         $idcard=@addslashes(trim($v['F'])); 
         $phone=@trim($v['G']);
		 $kc=@trim($v['H']);
		 $sql="insert into app_student(hao,qu,school,nianji,name,kc,idcard,phone) values('".$hao."','".$qu."','".$school."','".$nianji."','".$name."','".$kc."','".$idcard."','".$phone."'); ";
		 echo $sql;
		 echo "<br />";
	}
    $i++;
}



$inputFileName = 'g2.xls';
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName);
$sheetData = $spreadsheet->getActiveSheet()->toArray(null, false, false, true);
$i=1;
foreach($sheetData as $v){
    if (!empty($v['A']) &&  !empty($v['B']) && '准考证' != $v['A']){
		 $hao=trim($v['A']);
		 $qu=@trim($v['B']);
		 $school=trim($v['C']);
		 $nianji=trim($v['E']);
		 $name=trim($v['D']);
         $idcard=@addslashes(trim($v['F'])); 
         $phone=@trim($v['G']);
		 $kc=@trim($v['H']);
		 $sql="insert into app_student(hao,qu,school,nianji,name,kc,idcard,phone) values('".$hao."','".$qu."','".$school."','".$nianji."','".$name."','".$kc."','".$idcard."','".$phone."'); ";
		 echo $sql;
		 echo "<br />";
	}
    $i++;
}


$inputFileName = 'g3.xls';
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName);
$sheetData = $spreadsheet->getActiveSheet()->toArray(null, false, false, true);
$i=1;
foreach($sheetData as $v){
    if (!empty($v['A']) &&  !empty($v['B']) && '准考证' != $v['A']){
		 $hao=trim($v['A']);
		 $qu=@trim($v['B']);
		 $school=trim($v['C']);
		 $nianji=trim($v['E']);
		 $name=trim($v['D']);
         $idcard=@addslashes(trim($v['F'])); 
         $phone=@trim($v['G']);
		 $kc=@trim($v['H']);
		 $sql="insert into app_student(hao,qu,school,nianji,name,kc,idcard,phone) values('".$hao."','".$qu."','".$school."','".$nianji."','".$name."','".$kc."','".$idcard."','".$phone."'); ";
		 echo $sql;
		 echo "<br />";
	}
    $i++;
}



$inputFileName = 'zz.xls';
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName);
$sheetData = $spreadsheet->getActiveSheet()->toArray(null, false, false, true);
$i=1;
foreach($sheetData as $v){
    if (!empty($v['A']) &&  !empty($v['B']) && '准考证' != $v['A']){
		 $hao=trim($v['A']);
		 $qu=@trim($v['B']);
		 $school=trim($v['C']);
		 $nianji=trim($v['E']);
		 $name=trim($v['D']);
         $idcard=@addslashes(trim($v['F'])); 
         $phone=@trim($v['G']);
		 $kc=@trim($v['H']);
		 $sql="insert into app_student(hao,qu,school,nianji,name,kc,idcard,phone) values('".$hao."','".$qu."','".$school."','".$nianji."','".$name."','".$kc."','".$idcard."','".$phone."'); ";
		 echo $sql;
		 echo "<br />";
	}
    $i++;
}

echo 'COMMIT;';